<script type="text/javascript" src="${MEI_PATH_RELATIVE}/addons/smarteditor/js/HuskyEZCreator.js" charset="utf-8"></script>

<script>
// 자동으로 <br> , <p>&nbsp;</p> 삽입되는 문제를 해결
function ja_smarteditor(obj) {

  jQuery.jaAction.setDefaults({
    
    prepare : function() {
      try {
        var cnt = obj.length;
        for (var i = 0; i < cnt; i++) {
          /*
          var text = obj[i].getIR();
          var regx = /(\<br\>|\<p\>\<br\>\<\/p\>|\<p\>&nbsp;\<\/p\>){1}$/;
          if (regx.test(text)) { text = text.replace(regx,''); }
          obj[i].setRawHTMLContents(text);
          */
          obj[i].exec("UPDATE_CONTENTS_FIELD", []);
        }
      } catch (e) {
        alert("SmartEditor2 : " + e);
      }
    }

  });

}

var MEIeditor = [ ];
var objEditor = [ ];

var smarteditor_config = {
    oAppRef: MEIeditor,
    elPlaceHolder: "",
    sSkinURI: "${MEI_PATH_RELATIVE}/addons/smarteditor/SmartEditor2Skin.html",	
    htParams : {
      bUseToolbar : true,				// 툴바 사용 여부 (true:사용/ false:사용하지 않음)
      bUseVerticalResizer : true,		// 입력창 크기 조절바 사용 여부 (true:사용/ false:사용하지 않음)
      bUseModeChanger : true,			// 모드 탭(Editor | HTML | TEXT) 사용 여부 (true:사용/ false:사용하지 않음)
      fOnBeforeUnload : function(){ }
    }, //boolean
    fOnAppLoad : function(){ },
    fCreator: "createSEditor2"
};
</script>

<#macro addon_smarteditor target seq = "0" config = "smarteditor_config">
  nhn.husky.EZCreator.createInIFrame(

    jQuery.extend(true,${config} , { 
      elPlaceHolder: "${target}",
      fOnAppLoad : function(){
        objEditor[${seq}] = MEIeditor.getById['${target}'];
        ja_smarteditor(objEditor);
      }
    })
  );

</#macro>

<#macro addon_editor target seq = "0" config = "smarteditor_config">
<@addon_smarteditor target=target seq=seq config=config />
</#macro>